<!DOCTYPE html>
<html>
	<head th:replace="/mobile/common::head(~{::custom_settings})">
		<th:block th:fragment="custom_settings">
			<title>顺山科技智慧生活服务平台</title>
			<link type="text/css" rel="stylesheet" th:href="@{{css}/mobile/member/mobileshoppingcart/mobileShoppingCart.css(css=${css})}"/>
			<script th:inline="javascript">
				var _isbackUrl = [[${param.backUrl == null ? '' : param.backUrl[0]}]];
			</script>
		</th:block>
	</head>
	<body>
		<div class="weui-tab">
			<div class="weui-tab__bd">
			    <div class="weui-tab-title-shopping">
			    	<th:block th:if = "${param.backUrl != null}">
			    		<i class="fa fa-angle-left" th:onclick="shoppingcart.goBack();"></i>
			    	</th:block>
			    	<h1>购物车</h1>
			    </div>
			    <div id="" > <!-- class="weui-tab__bd-item"> -->
			    	<div class="weui-tab-home-shopping">
			    		<div class="weui-cells weui-cells_checkbox" style="margin:0; overflow:auto; height:100%;">
			    			<th:block th:each="merchant, m : ${shoppingCart.merchantObj}">
				    			<div class="weui-shopping-lists">
				    				<div class="weui-tab-buylist-gtime">
					      				<div class="weui-tab-buylist-gtime1"><i checkbox="mni" th:class="${merchant.selectstate}?'weui-icon-success':'weui-icon-circle'" style="float:left; margin-left:-5px; line-height:40px;" th:id="'merchantname' + ${m.count}" th:onclick="|shoppingcart.clickMerchantName('${m.count}');|"></i><h1><img th:src="@{{image}/mobile/member/pay-pic.png(image=${image})}"/><span th:text="${merchant.merchantname}"></span></h1></div>
				      				</div>
				    				<th:block th:each="sc, i : ${shoppingCart.goodSaleList}">
				    					<th:block th:if="${sc.merchantid} eq ${merchant.entityid}">
				    					 	<div class="weui-cell weui-cell_swiped weui-shopping">
								    			<label class="weui-cell weui-check__label" th:for="'checkbox_' + ${m.count} + '-'+ ${i.count}">
												    <div class="weui-cell__hd" th:onclick="|shoppingcart.clickSingleSelect('${m.count}-${i.count}');|">
												      <th:block th:if="${sc.selectstate}">
												      	<input type="checkbox" th:merchantname="'merchantname' + ${m.count}" class="weui-check" th:name="'checkbox' + ${m.count} + ${i.count}" th:id="'checkbox_' + ${m.count} + '-' + ${i.count}" checked>
												      </th:block>
												      <th:block th:if="${not sc.selectstate}">
												      	<input type="checkbox" th:merchantname="'merchantname' + ${m.count}" class="weui-check" th:name="'checkbox' + ${m.count} + ${i.count}" th:id="'checkbox_' + ${m.count} + '-' + ${i.count}" >
												      </th:block>
												      <i class="weui-icon-checked"></i>
												    </div>
							    			    </label>
							    			    
							    			    <th:block th:if="${sc.salestate eq 4 && sc.goodstock gt 0}"> <!-- 上架及库存大于0的商品 -->
										            <div class="weui-cell__bd">
										              <div class="weui-cell">
								    				 	<div class="weui-cell__hd weui-cell-shopping-img"><img th:src="${sc.photopath}" /></div>
										                <div class="weui-cell__bd" th:onclick="'javascript:showgoodinfo(\''+${sc.goodid}+'\',\''+${sc.merchantsettleid}+'\');'">
											                  <p class="cell-title-shopping" th:text="${sc.goodname}"></p>
														      <p class="cell-norms-shopping" ><em th:text="${sc.specdefine} + '/' + ${sc.meterunit}"></em>
														      	<th:block th:if="${sc.salestate eq 4 && sc.goodstock gt 0}">
														      		<em th:text="${sc.goodstock} le 10 ? '【仅剩' + ${sc.goodstock} + ${sc.specdefine} + '】' : '有货'"></em>
														      	</th:block>
														      	<input type="hidden" th:id="'goodstock_' + ${m.count} + '-' + ${i.count}" th:value="${sc.goodstock}"/><!-- 库存数量 -->
														      	<input type="hidden" th:id="'salestate_' + ${m.count} + '-' + ${i.count}" th:value="${sc.salestate}"/><!-- 商品状态 -->
														      </p>
														      <p class="cell-monly-shopping" th:id="'goodprice_' + ${m.count} + '-' + ${i.count}" th:text="${sc.goodprice}"></p><!-- <span>￥6.00</span> -->
										                </div>
										                <div class="weui-cell__ft">
										                  <div class="weui-count">
										                    <a class="weui-count__btn weui-count__decrease"></a>
										                    <input class="weui-count__number" type="number" th:id="'goodnumber_' + ${m.count} + '-' + ${i.count}" th:value="${sc.goodnumber}"/>
										                    <input type="hidden" th:id="'shoppingcartid_' + ${m.count} + '-' + ${i.count}" th:value="${sc.shoppingcartid}"/> <!-- 购物车id -->
										                    <a class="weui-count__btn weui-count__increase"></a>
										                  </div>
										                </div>
										              </div>
										            </div>
									            </th:block>
									            
									            <th:block th:if="${sc.salestate eq 1 || (sc.salestate eq 4 && sc.goodstock eq 0)}"> <!-- 停售及无货 -->
									            	<div class="weui-cell__bd">
										              <div class="weui-cell">
								    				 	<div class="weui-cell__hd weui-cell-shopping-img"><img th:src="${sc.photopath}" /></div>
										                <div class="weui-cell__bd" th:onclick="'javascript:showgoodinfo(\''+${sc.goodid}+'\',\''+${sc.merchantsettleid}+'\');'">
											                  <p class="cell-title-shoppings" th:text="${sc.goodname}"></p>
														      <p class="cell-norms-shopping" ><em th:text="${sc.specdefine} + '/' + ${sc.meterunit}"></em>
														      	<th:block th:if="${sc.salestate eq 1}"><em>【停售】</em></th:block>
														      	<th:block th:if="${sc.salestate eq 4 && sc.goodstock eq 0}"><em>【无货】</em></th:block>
														      	<input type="hidden" th:id="'goodstock_' + ${m.count} + '-' + ${i.count}" th:value="${sc.goodstock}"/><!-- 库存数量 -->
														      	<input type="hidden" th:id="'salestate_' + ${m.count} + '-' + ${i.count}" th:value="${sc.salestate}"/><!-- 商品状态 -->
														      </p>
														      <p class="cell-monly-shoppings" th:id="'goodprice_' + ${m.count} + '-' + ${i.count}" th:text="${sc.goodprice}"></p><!-- <span>￥6.00</span> -->
										                </div>
										                <div class="weui-cell__ft">
										                  <div class="weui-count">
										                    <a class="weui-count__btn weui-count__decrease weui-btn-dis" ></a>
										                    <input class="weui-count__number weui-count-num" type="number" disabled th:id="'goodnumber_' + ${m.count} + '-' + ${i.count}" th:value="${sc.goodnumber}"/>
										                    <input type="hidden" th:id="'shoppingcartid_' + ${m.count} + '-' + ${i.count}" th:value="${sc.shoppingcartid}"/> <!-- 购物车id -->
										                    <a class="weui-count__btn weui-count__increase weui-btn-disa"></a>
										                  </div>
										                </div>
										              </div>
										            </div>
									            </th:block>
									            
									            <div class="weui-cell__ft">
									              <a class="weui-swiped-btn weui-swiped-btn_warn delete-swipeout" th:id="'del_' + ${m.count} + '-' + ${i.count}">删除</a>
									              <a class="weui-swiped-btn weui-swiped-btn_default close-swipeout" href="javascript:">关闭</a>
									            </div>
									        </div>
				    					</th:block>
				    				</th:block>
				    			</div>
			    			</th:block>
						</div>
			    		
			    		<div class="weui-payment-bar">
			    			<div class="weui-all-checkbox">
						        <i id="selete-all" class="weui-icon-circle" onclick="shoppingcart.clickAllSelect();"></i>&nbsp;全选
			    			</div>
			    			<div class="weui-shop-total">
			    				<stong>合计：<b id="total" th:text="${shoppingCart.totalPrice}">0.00</b></stong>
			    			</div>
			    			<div class="weui-settlement" onclick="shoppingcart.clickSettlementShoppingCart();">结算</div>
			    		</div>
			    	</div>
			    </div>
		   </div>
		   <th:block th:if = "${param.backUrl == null}">
			   <th:block th:replace="/mobile/member/common::common_mobile_tabbar(3)"/>
		   </th:block>
		</div>
		<!-- 商品详情引用 -->
		<th:block th:replace="/mobile/member/menulist/menuListDetails"/> 
		<!-- 商品详情引用 -->
	<script type="text/javascript" th:src="@{{js}/mobile/member/mobileshoppingcart/mobileShoppingCartHandler.js(js=${js})}"></script>
	</body>
</html>
	